<?php
   //if( $_SERVER['REQUEST_METHOD'] != 'POST' )
   //{
   //   echo 'no this method' ;
   //   return ;
   //}

   require_once 'error_config.php' ;
   require_once 'const_config.php' ;
   require_once 'mysql.php' ;

   $DataTableName =array( 
      'news' => 'tb_news',
      'microblog' => 'tb_weibo'
   ) ;

   //$tableName =$DataTableName[ $_POST['type'] ] ;
   //if( empty( $tableName ) )
   //{
   //   echo 'no table' ;
   //   return ;
   //}

   //  链接数据库
   $mySql =new CMySql( $SqlConfig['host'], $SqlConfig['user'], $SqlConfig['pwd'], $SqlConfig['db'], $SqlConfig['port'] ) ; 

   // 插叙数据
   $sql    ='SELECT * FROM %s ;' ;
   //$params =array( $tableName ) ;
   $params =array( 'tb_weibo' ) ;
   $ret    =$mySql->Query( $sql, $params ) ; 
   if( $ret === false )
   {
	  return ;
   }

   $retVal =array() ;
   while( $dataRow =$ret->GetObj() )
   {
	  $retVal[] =$dataRow ;
   }

   $jsonVal =json_encode( $retVal ) ;
   //$jsonVal =json_encode( $retVal, JSON_PRETTY_PRINT  ) ;
   //$jsonVal =json_encode( $retVal, JSON_FORCE_OBJECT ) ;
   //$jsonVal =json_encode( $retVal, JSON_PRETTY_PRINT | JSON_FORCE_OBJECT ) ;

   echo $jsonVal ;

?>

